#include<iostream>
#include<cstdio>
using namespace std;
const int N = 1e5 + 10;
int tree[N];
int n, m;
int lowbit(int x)
{
    return x & (-x);
}
void add(int i, int u)
{
    for (int y = i; y <= n; y += lowbit(y)) {
        tree[y] += u;
    }
}
int query(int x)
{
    int sum = 0;
    for (int i = x; i; i -= lowbit(i)) {
        sum += tree[i];
    }
    return sum;
}
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
        int a;
        scanf("%d", &a);
        add(i, a);
    }
    while (m--) {
        int k, a, b;
        scanf("%d%d%d", &k, &a, &b);
        if (k == 1) {
            add(a, b);
        }
        else {
            cout << query(b) - query(a - 1) << endl;
        }
    }
    return 0;
}